package com.itheima.controller;

import com.itheima.common.constant.MessageConstant;
import com.itheima.common.entity.Result;
import com.itheima.dto.LoginDTO;
import com.itheima.service.ValidateCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/validatecode")
public class validateCodeController {

    @Autowired
    private ValidateCodeService validateCodeService;

    /**
     * 发送预约验证码
     * @param telephone
     * @return
     */
    @PostMapping("/send4Order")
    public Result send4Order(String telephone){
        validateCodeService.send4Order(telephone);
        return new Result(true, MessageConstant.SEND_VALIDATECODE_SUCCESS);
    }

    /**
     * 发送登录验证码
     * @param telephone
     * @return
     */
    @GetMapping("/send4Login")
    public Result send4Login(String telephone){

        validateCodeService.send4Login(telephone);
        return new Result(true, MessageConstant.SEND_VALIDATECODE_SUCCESS);
    }
}
